/*
 * @Author: Zhang Kai
 * @Date: 2021-10-29 15:07:32
 * @LastEditors: mayijun
 * @LastEditTime: 2022-05-14 12:15:01
 * @FilePath: /metricsx-standard-ui/src/utils/crumbs-addon/modules/getnumber-step2.tsx
 */
// 指标取数第二步
import * as RouteNames from '@/router/consts';
import router from '@/router';
import ModelButtonRole from '@/components/modelButtonRole';
import { store } from '@/store';

const IndexLibrayrCrumb = {
  // 指标详情页
  [RouteNames.ROUTE_INDEXDETAIL]: (to: any) => {
    store.commit('breadcrumb/setPathname', to.path);
    store.commit('breadcrumb/setRawPath', to);
    store.commit('breadcrumb/setFullPath', to.fullPath);
    store.commit('breadcrumb/setName', to.name);
    store.commit('breadcrumb/setShowReturn', true); //是否显示返回
    // 返回对象及返回动作
    store.commit('breadcrumb/setBackParams', {
      name: RouteNames.ROUTE_INDEXLIBRARY
    });
    // 按钮动作
    store.commit('breadcrumb/setAddonActions', [
      //
      {
        getAddon: () => {
          return (
            <el-button
              onClick={() =>
                store.commit('indexlibrary/toggleDrawerVisible', true)
              }
            >
              收藏的指标
            </el-button>
          );
        }
      }
    ]);
  }
};
export default IndexLibrayrCrumb;
